Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1195
  • Last Modified:

Safari: document.createElement does not work?

Hi experts,

I am testing my web application and found that

obj = document.createElement(...)

does not work on Safari though it works fine on Firefox, IE8 and Chrome.

I googled online and found this post http://slayeroffice.com/archives/?p=172. Does anybody have any other suggestions on how to handle this issue?

Thanks so much.

0
davidw88
Asked:
davidw88
  • 2
1 Solution
 
leakim971PluritechnicianCommented:
Hello davidw88,

Work for me.
Could you post your full code ?

Regards.
<html>
<head>
<script type="text/javascript">
	function addElement() {
	  newDiv = document.createElement("div");
	  newDiv.innerHTML = "<h1>Congratulations!</h1>";
	  mydiv = document.getElementById("div1");
	  document.body.insertBefore(newDiv, mydiv);
	}
</script>
</head>
<body onload="addElement()">
	<div id="div1">I'm the next line</div>
</body>
</html>

Open in new window

0
 
davidw88Author Commented:
Cool. Thanks leakim971!
0
 
leakim971PluritechnicianCommented:
You're welcome! Thanks for the points! Have fun!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now