Solved

I have a problem with my js

Posted on 2009-04-06
9
352 Views
Last Modified: 2013-11-19
hi i don't seem to find the problem i looked it a 1000 times but don't seem to find the problem it don't works
var get = '<a href='javascript:(function(){var myDiv=document.createElement("div");myDiv.setAttribute("id","my_div");document.body.appendChild(myDiv);myDiv=document.getElementById("my_div");myDiv.innerHTML="<iframe frameborder=\"no\" border=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" src=\"http://google.com\" width=\"1000\"height=\"1000\"> </iframe>";myDiv.style.position="absolute";myDiv.style.left="0px";myDiv.style.top="0px";})();'><button type="submit" " class="VIpriBtn"><span class="btn"><span class="btn">get &gt;</a></span></span>';
 
function b2(){r=t1.insertRow(3);c=r.insertCell(0);c.noWrap='nowrap';c.innerHTML = '<span class="title"><img src="http://google.com" alt="pix" align="middle"> price:</span>';c=r.insertCell(1);c.noWrap='nowrap';c.innerHTML = '<b>plm</b>';c=r.insertCell(2);c.noWrap = 'nowrap';c.innerHTML = ''+ get +'</button>';};

Open in new window

0
Comment
Question by:luckian121
9 Comments
 
LVL 12

Accepted Solution

by:
Dean OBrien earned 250 total points
ID: 24075990
Its hard to comprehend what your trying to do with such badly laid out code... i spotted you were missing a space between your height and width declaration.

I fixed the first function to include the iFrame, wasnt sure what the 2nd one was trying to achieve....

Easynow
<HTML><HEAd><script>
function test()
{
	var myDiv=document.createElement("div");
	myDiv.setAttribute("id","my_div");
	document.body.appendChild(myDiv);
	myDiv=document.getElementById("my_div");
	myDiv.innerHTML='<iframe frameborder=\"no\" border=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" src=\"http://google.com\" width=\"1000\" height=\"1000\"> </iframe>';
	myDiv.style.position="absolute";
	myDiv.style.left="0px";
	myDiv.style.top="0px";
}
 
 
function b2()
{
	r=t1.insertRow(3);
	c=r.insertCell(0);
	c.noWrap='nowrap';
	c.innerHTML = '<span class="title"><img src="http://google.com" alt="pix" align="middle"> price:</span>';
	c=r.insertCell(1);c.noWrap='nowrap';
	c.innerHTML = '<b>plm</b>';
	c=r.insertCell(2);
	c.noWrap = 'nowrap';
	c.innerHTML = ''+ get +'</button>';
}
</script>
<body onload="test();">
<p>content</p>
</body>
</html>

Open in new window

0
 

Author Comment

by:luckian121
ID: 24076371
no that didn't work
function b2(){r=t1.insertRow(3);c=r.insertCell(0);c.noWrap='nowrap';c.innerHTML = '<span class="get"><img src=15x54.gif" alt="get" align="middle"> price:</span>';c=r.insertCell(1);c.noWrap='nowrap';c.innerHTML = '<b>get</b>';c=r.insertCell(2);c.noWrap = 'nowrap';c.innerHTML = '<a href=\'javascript:(function(){var myDiv=document.createElement("div");myDiv.setAttribute("id","my_div");document.body.appendChild(myDiv);myDiv=document.getElementById("my_div");myDiv.innerHTML="<iframe frameborder=\"no\" border=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" src=\"http://google.com\"width=\"1000\" height=\"1000\"></iframe>";myDiv.style.position="absolute";myDiv.style.left="0px";myDiv.style.top="0px";})();\'><button type="submit" " class="VIpriBtn"><span class="btn"><span class="btn">get &gt;</span></span></button></a>';};

Open in new window

0
 

Author Comment

by:luckian121
ID: 24076384
this one  looks good but it's not working... what I'm trying is to recode the page on load
function b2(){r=t1.insertRow(3);c=r.insertCell(0);c.noWrap='nowrap';c.innerHTML = '<span class="get"><img src=15x54.gif" alt="get" align="middle"> price:</span>';c=r.insertCell(1);c.noWrap='nowrap';c.innerHTML = '<b>get</b>';c=r.insertCell(2);c.noWrap = 'nowrap';c.innerHTML = '<a href=\'javascript:(function(){var myDiv=document.createElement("div");myDiv.setAttribute("id","my_div");document.body.appendChild(myDiv);myDiv=document.getElementById("my_div");myDiv.innerHTML="<iframe frameborder=\"no\" border=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" src=\"http://google.com\"width=\"1000\" height=\"1000\"></iframe>";myDiv.style.position="absolute";myDiv.style.left="0px";myDiv.style.top="0px";})();\'><button type="submit" " class="VIpriBtn"><span class="btn"><span class="btn">get &gt;</span></span></button></a>';};

Open in new window

0
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 
LVL 12

Expert Comment

by:Dean OBrien
ID: 24076547
Are you intentionally using impossible to read layout?
0
 
LVL 12

Expert Comment

by:Dean OBrien
ID: 24076618
Your functions refer to variables that dont appear to exist 't','c','r'...

Include you full code (with some attempt at spacing) else nobody can help you.
0
 

Author Comment

by:luckian121
ID: 24076657
never mind that i resolved it :D thanks anyway.

but do you know a function  something like this <a href=javascript:resize page>resize</a>
0
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 250 total points
ID: 24076867
<a href="#" onClick="window.resizeTo(800,600); return false">Resize</a>
0
 
LVL 16

Expert Comment

by:CWS (haripriya)
ID: 37169582
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to combine and minify CSS and JS files 5 16
Wordpress Security 29 48
Link failure 16 32
formvalidation.io validate form on class click 4 13
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question