473,396 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

storing html into javascript variable

hi, i have a simlpe question.

i need to store html into variable.
Expand|Select|Wrap|Line Numbers
  1. var myCode = "<div><iframe scrolling=\"no\" frameborder=\"1\" style=\"position:absolute;width:225px;height:160px;border:none;display:block;z-index:0\"></iframe></div>"
  2.  
apparently it produces an error, why?
i can store any html into a variable except when i store html with <iframe> tags,
why is that so?
Sep 28 '07 #1
6 10547
gits
5,390 Expert Mod 4TB
hi ...

what error do you get? and when?

kind regards
Sep 28 '07 #2
hi ...

what error do you get? and when?

kind regards
what i mean by error is that no output is displayed. try opening:
http://www.glitzy3.com/colors.php
if you click choose color, it will open. BUT if i include in my script a variable that will hold information with the "<iframe>" tag, then nothing displays if you press "choose color", implying that there is an error in script, right?
(ps: in IE it displays error in that status bar)

i can declare a variable that will hold example:
Expand|Select|Wrap|Line Numbers
  1. var myCode = "<div width=\"100px\" height=\"20px\"><p>this html code is stored in myCode variable</p></div>"
  2.  
but i CANNOT have a variable that will hold <iframe> tags like example:
Expand|Select|Wrap|Line Numbers
  1. var myCode = "<div><iframe scrolling=\"no\" frameborder=\"1\" style=\"position:absolute;width:225px;height:160px;border:  none;display:block;z-index:0\"></iframe></div>"
  2.  
is there something wrong with <iframe> tag of not being able to be contained in a variable?
Sep 28 '07 #3
gits
5,390 Expert Mod 4TB
do you assign a src-document to the iframe in any way when using it?

kind regards
Sep 28 '07 #4
epots9
1,351 Expert 1GB
what i mean by error is that no output is displayed. try opening:
http://www.glitzy3.com/colors.php
if you click choose color, it will open. BUT if i include in my script a variable that will hold information with the "<iframe>" tag, then nothing displays if you press "choose color", implying that there is an error in script, right?
(ps: in IE it displays error in that status bar)

i can declare a variable that will hold example:
Expand|Select|Wrap|Line Numbers
  1. var myCode = "<div width=\"100px\" height=\"20px\"><p>this html code is stored in myCode variable</p></div>"
  2.  
but i CANNOT have a variable that will hold <iframe> tags like example:
Expand|Select|Wrap|Line Numbers
  1. var myCode = "<div><iframe scrolling=\"no\" frameborder=\"1\" style=\"position:absolute;width:225px;height:160px;border:  none;display:block;z-index:0\"></iframe></div>"
  2.  
is there something wrong with <iframe> tag of not being able to be contained in a variable?
are you getting a javascript error or nothing is happening?
Sep 28 '07 #5
do you assign a src-document to the iframe in any way when using it?

kind regards
nop. i don't assign a src-doc to it. since the <iframe> is a window-based component like the <select>, i use it to solve the IE <select> OVERLAP BUG. in that it overlaps the select components and then my color table can be put ontop of the <iframe>.

i searched the web and that is the best solution they had for offer and it does work satisfactorily. Since i coudn't put the <iframe> into a variable within the color table function, i just put it in the main doc as plain html before i called the color table function in an external .js file.

but anyways thanx for your help. i think i can live with that hehehehe...
hop you'll answer my future questions

kind regards also hehehe..
Sep 29 '07 #6
gits
5,390 Expert Mod 4TB
hi ...

of course we will answer :) ... however, how do you use the stored html from your varible? setting innerHTML? did you try to use createElement and appendChild instead ... may be that could solve your problem?

kind regards
Sep 29 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: VK | last post by:
09/30/03 Phil Powell posted his "Radio buttons do not appear checked" question. This question led to a long discussion about the naming rules applying to variables, objects, methods and properties...
1
by: cirillo_curiosone | last post by:
Hi, i'm new to javascript. I started studing it on the web few weeks ago, but still haven't been able to solve one big problem: HOT TO PASS VALUES FROM A SCRIPT VARIABLE TO A CHILD HTML...
2
by: Mark Hannon | last post by:
I am trying to wrap my brain around storing form elements inside variables & arrays before I move on to a more complicated project. I created this simple example to experiment and as far as I can...
4
by: Frank Rizzo | last post by:
In classic ASP, it was considered a bad idea to store VB6-created objects in the Application variable for various threading issues. What's the current wisdom on storing objects in the Application...
2
by: Angel | last post by:
I am storing a value into a javascript variable that was keyed into a text control. When the code performs a postback, the value that was stored into a clientside variable no longer exists. Is...
2
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is...
3
by: Markus Schuster | last post by:
Hi, I have the following javascript function: <script type="text/javascript"> function HTMLEncode( text ) { text = text.replace(/&/g, "&amp;") ; text = text.replace(/"/g, "&quot;") ;
8
by: bendes | last post by:
Hi all, I just have a quick question here: I have this site: http://irx.inf.elte.hu/~begoaai/pizzaboy/index2.html It's sort of a pizza online order site, you can order pizza, you can...
42
by: Santander | last post by:
how to decode HTML pages encoded like this: http://www.long2consulting.com/seeinaction2008/Simplicity_Beach_table/index.htm Is there script that will do this automatically and generate normal fully...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.