• Das Erstellen neuer Accounts wurde ausgesetzt. Bei berechtigtem Interesse bitte Kontaktaufnahme über die üblichen Wege. Beste Grüße der Admin

[GELÖST] Funktionsaufruf mit Parameter in document.write einbinden

mucrobber

New member
Hallo Herrschaften,

habe SuFu benutzt und nichts dazu gefunden. Sorry, falls ich was übersehen habe. Es ist eigentlich ein eher kleines Problem, aber ich komm nicht drauf, darum bin ich für Hilfe echt dankbar. Und der JS-Crack bin ich ohnehin nicht gerade :confused:

Und zwar möchte ich in document.write eine onload-Funktion aufrufen - mein Problem sind dabei die Anführungszeichen.

Code:
document.write("<iframe src='"+URL+"' marginwidth='0' marginheight='0' frameborder='0' class='myClass' id='myIDString' onload="myJSfunction('myIDString', 'https://myURL.com');"></iframe>");

Ich weiß, dass es so nicht funktioniert, die Gänsefüßchen im onload sind falsch. Aber ich kann sie ja nicht escapen?
Hat jemand einen Tipp für mich?
 
Zuletzt bearbeitet von einem Moderator:
Ich Hirni - hatte eines falsch gesetzt und habe mich gewundert, dass es nicht funktioniert hat. Sorry Leute, hat sich erledigt. Trotzdem danke :)
 
Zu document.write:
http://www.w3.org/html/wg/drafts/html/CR/webappapis.html#dynamic-markup-insertion schrieb:
This method has very idiosyncratic behavior. In some cases, this method can affect the state of the HTML parser while the parser is running, resulting in a DOM that does not correspond to the source of the document (e.g. if the string written is the string "<plaintext>" or "<!--"). In other cases, the call can clear the current page first, as if document.open( ) had been called. In yet more cases, the method is simply ignored, or throws an exception. To make matters worse, the exact behavior of this method can in some cases be dependent on network latency, which can lead to failures that are very hard to debug. For all these reasons, use of this method is strongly discouraged.
 
Zurück
Oben