Creating XHTML In An Iframe

Aug 26, 2005

I am trying to find a way to load XHTML content in an Iframe.

I use to do this in html by using the following code :

var iframeObject = document.createElement("iframe");
MyDiv.appendChild(iframeObject);
var data =
"<html><head><title>testing</title></head><body>data</body></html>"
iframeObject.contentDocument.open();
iframeObject.contentDocument.writeln(data);
iframeObject.contentDocument.close();

This works fine. I can create my content dynamicly and synchroniously.
No problem.

No I try to switch to XHTML, but have trouble getting th eiframe to
understand that it gets XHTML data. It simply assumes that the data is
"text/html".
I tried to add the contentType with the .open() arguments:

var iframeObject = document.createElement("iframe");
MyDiv.appendChild(iframeObject);
var data = "<!DOCTYPE html PUBLIC "-//W3C//DTD ..etc..
transitional.dtd">"
+ "<html xmlns="http://www.w3.org/1999/xhtml" > etc etc </html>";
iframeObject.contentDocument.open("application/xhtml+xml", true);
iframeObject.contentDocument.writeln(data);
iframeObject.contentDocument.close();

The code runs but the content is not seen as xhtml, so I can't mix html
and xml. Someone gave me the hint to use the following:

iframeObject.src="data:application/xhtml+xml,"+data;

This works, the data gets loaded and is actually seen as xhtml, but..
the loading happens async in stead of sync.

Is there anyone who can help me with :
- does document.open("application/xhtml+xml", true) work at all?
should it work ?

View 16 Replies


ADVERTISEMENT

Creating A Web Keyboard For Data Entry Within IFRAME

Jul 20, 2005

i'm loading an external web page (i.e. google.com, espn.com) into
an IFRAME on top of a web application we have running in IE running on
a kiosk. the kiosk is only a touch screen and has no hardware
keyboard.

i'm looking to create a software keyboard that can be requested by a
click on our web application (a web page for all intents and
purposes). the windows accessibility keyboard would be ok, but when
opened from the browser you get the 'confirm opening an exe' dialog,
which ain't cool.

so next i was hoping make an html/flash keyboard
which would talk to the forms within the IFRAME via a javascript
layer. however i later found that javascript is not permitted to
access the contents of a document within an IFRAME loaded from an
external web site. so there is no way for javascript to directly
modify the text values of the form elements.

so now i'm stuck....i'm limited to solutions above the IFRAME
level...is there a way to programmatically mimic a keypress and send
it to the browser from within the browser? any other ideas?

View 1 Replies View Related

Creating An Iframe In Function And Loading Source

Jun 22, 2011

I create an iframe in script and load it with this code.

[Code]...

This should force the loading of the savepages.php file. In that file I do an echo to verify that it is called.

[Code]...

The objective is to call that php function. The javascript function is called. I don't know if the element is actually created. Unlike php javascript doesn't put anything in the source for us to verify. I don't have ajax. How can I make the javascript function call create an element that loads the php file and causes the code in that php file to execute.

View 2 Replies View Related

Creating An "Insert Table Function" For Use In An Iframe

Jul 23, 2005

I currently have an iframe on a webpage into which users can insert content. They can further customise the text as I've included buttons such as Bold, Italic, Bullet point etc. This is done along the lines of

<td><div class="cbtn" onClick="cmdExec('bold',idContent)"
onmouseover="button_over(this);" onmouseout="button_out(this);"
onmousedown="button_down(this);" onmouseup="button_up(this);">
<img hspace="1" vspace=1 align=absmiddle src="images/Bold.gif"
alt="Bold">
</div></td>

But has anyone found a way of creating a table for insertion in an Iframe. A much bigger task I realise but I'm not keen on users copying tables from Word and inserting them into the iframe.

View 2 Replies View Related

XML In XHTML

Nov 30, 2005

I am trying to include and xml document inside my xhtml document. There
are a number of reasons for this including portability, multiple
interface generation, and scalability of information.
My problem is that javascript is understanding the nodes in my xml
document as html elements.

<xml>
<book>
<title>Lord of the Rings</title>
</book>
</xml>

If I parse this, the title element cannot be extracted and the page
title(in the browser) becomes "Lord of the Rings".
Is there a way to exclude this xml node from the xhtml rules?

View 6 Replies View Related

DOM In XHTML On IE6

Feb 27, 2007

Maybe you can answer a question for me: I'm reading the preview for XML web development (sitepoint book) and it clearly shows IE rendering XML (the author states IE5 and above); does that mean that IE's problem with XHTML is CDATA and not XML universally? If that's true then IE could render an albeit gimped XHTML page which would explain why HTML 4.01 and XHTML are virtually synonymous in IE 6.

Is there a workaround for this in JavaScript, if the above is true?

View 5 Replies View Related

Getting Correct Xhtml From DIV

Dec 23, 2005

I'm facing the bug about the failure of innterHTML while
reading xhtml content inside a DIV, in fact it has passed as html
removing the closing of some nodes. Is there a way to read the content
of the div perfectly how it is in the page, kind of:

var obj = document.getElementById("myDIV");
var realContent = obj.toString();

View 22 Replies View Related

IE6, Xhtml, Scrollbars And You

Jul 20, 2005

IE6 in standards mode doesn't seem to hide scrollbars on the body element
(overflow:hide) Ain't this a quandary. I have it in my head that I need to
specify html instead. The scrollbars do hide on Gecko browsers though, so
there is definitely a disagreement among browser developers on how to
implement scrollbars (as a side note, Gecko browsers with their notoriously
bug-ridden resize code seem to always screw up when asked to stretch and
scroll divs, even when the page is reloaded on every resize!)

My first thought is to modify the CGI that generates the style sheet as I
already have code that deprecates the document type when hidden scroll bars
are required on IE6 (but not IE5.) This is based on the simple empirical
evidence that the scroll bars are still there on IE6 in standards mode, so
the optimal document type (XHTML strict) cannot be used. So I could just
change this to output an html style (rather than a body style) for IE6 and
lose the deprecation (it wouldn't be needed at this point.)

So the question is this. Given that CGI-based processing of browser
versions for these kinds of tweaks is taboo, what would you check on the
client side before dynamically generating the style for the body and/or html
element? It doesn't seem like you could just send both as this would surely
break some older browsers (I know you can do tricks with comments and such,
but that only works for NS4 and maybe IE3 AFAIK.)

documentElement is the only thing I can think of that indicates standards
mode and NS6/Mozilla support this AFAIK.

IE Conditional comments perhaps? I would hate to hard-code a test for a
browser version number into the actual document (for obvious reasons), but I
guess it is an alternative if the browser version is exposed to these
things.

I don't see any other way to deal with a situation like this than with
server-side code that looks at the browser's version number and makes the
necessary adjustment. And there are lots of little differences like this
that just don't seem to have viable client-only solutions. There's DirectX
stuff (probably is an object detect for that) and funky colored scrollbars
(hey people ask for them) and document margins (Opera did them slightly
differently than the rest as I recall) and now this scrollbar thing.

View 24 Replies View Related

Xhtml Validation

Aug 15, 2007

How do you get JS to validate? Am more or less positive my JS used to validate now the following won't even pass

if(1==1 && 2==2)
{

}

why? because the validator wants &amp;&amp;

Any ideas how even that script can be validated. The doc type is transitional.

View 4 Replies View Related

Xhtml W/javascript And Css Only Works In IE

Jul 23, 2005

There are two main things which I am trying to work through:

Drop down menu (bottom of page) - which only works in IE (on pc) right
now, although it should work on all browsers except opera.
Traditionally in a HTML 4.0 Transitional environment.

Div content that scrolls - placed correctly and works in IE and that's
it. Here is an example of the working script on another site
http://www.dyn-web.com/dhtml/scroll/scroll-rel.html . Traditionally in
a Xhml strict.

My goal is to get this page to look as good in Netscape and on the mac
as it already does in IE.

View 2 Replies View Related

InnerHTML Mangles The Xhtml

Jul 23, 2005

When using innerHTML to insert xhtml IE5+ mangles the xhtml completely. For example it removes the quotes from attributes. It also does other ridiculous things like on a <div> it will insert the enbedded style="DISPLAY:BLOCK"! This is a documented feature you can find in msdn.

Is there a way to disable this quite appalling feature?

View 10 Replies View Related

Document.createElement() In XHTML

Nov 25, 2006

I try the following in Firefox and other modern browsers:

window.addEventListener('load', function() {
document.title = CSS.getClass('fontSize');
var div = document.createElement('div');
document.getElementsByTagName('body')[0].appendChild(div);
alert(div);
alert(div.style)
}, true);

It works fine in normal HTML mode (Content-type: text/html), but in
XHTML mode it alerts "[object Element]" instead of "[object
HTMLDivElement]" and the second alert shows "undefined" instead of
"[object CSSStyleDeclaration]". So I can't reach the style declaration
which is important for me. Strict mode makes trouble again and again,
the biggest bug: document.write does not work:

View 10 Replies View Related

Textarea In XHTML 1.0 Transitiona

Nov 7, 2007

I've just been converting my ASP v2.0 web site to use master pages which by
default uses this doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

whereas before it used to use:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

This appears to have effected the multi-line textarea tag in that it doesn't
completely obey the height attribute. It appears to adjust the height to the
nearest line height.

Is there anyway to get around this?

View 1 Replies View Related

XHTML, <script>, Opera

Jul 20, 2005

Opera 7 doesn't appear to support the <script> element in XHTML. Does
this mean that it impossible to use Javascript with XHTML? Or is there
a workaround, such as the legacy method, in HTML, of commenting out the
Javascript code.

View 1 Replies View Related

JQuery :: Can't Deal With XHTML DOM?

Mar 21, 2010

Can JQuery deal with XHTML DOM?I was told that it cannot and that I should use only HTML Strict.

View 2 Replies View Related

XHTML 1.1 Valid Aligning

Apr 24, 2007

An easy XHTML1.1 valid way of aligning divsfunction XHTMLAlign(tagid, align){

var viewportwidth;
var viewportheight;

// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

if (typeof window.innerWidth != 'undefined')
{
viewportwidth = window.innerWidth,
viewportheight = window.innerHeight
}

// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth !=
'undefined' && document.documentElement.clientWidth != 0)
{
viewportwidth = document.documentElement.clientWidth,
viewportheight = document.documentElement.clientHeight
}

// older versions of IE

else
{
viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
viewportheight = document.getElementsByTagName('body')[0].clientHeight
}

var tag = document.getElementById(tagid);
tag.style.position="absolute";
if(tag.style.marginLeft == ""){
tag.style.marginLeft = "0";
}
if(tag.style.marginRight == ""){
tag.style.marginRight = "0";
}
if(tag.style.marginTop == ""){
tag.style.marginTop = "0";
}
if(tag.style.marginBottom == ""){
tag.style.marginBottom = "0";
}
if(tag.style.width == ""){
if (tag.width != ""){
tag.style.width = tag.width;
} else {
tag.style.width = "0";
}
}
if(tag.style.height == ""){
if (tag.height != ""){
tag.style.height = tag.height;
} else {
tag.style.height = "0";
}
}
if ( align=="left" ){
tag.style.left=parseInt(tag.style.marginLeft) + "px";
tag.style.right= viewportwidth - (parseInt(tag.style.width) + parseInt(tag.style.marginLeft)) + "px";
} else if ( align=="right" ){
tag.style.right=parseInt(tag.style.marginLeft) + "px";
tag.style.left=viewportwidth - (parseInt(tag.style.width) + parseInt(tag.style.marginRight)) + "px";
} else if ( align=="center" ){
tag.style.right= ((viewportwidth - parseInt(tag.style.width))/2) - parseInt(tag.style.marginLeft) + parseInt(tag.style.marginRight) + "px";
tag.style.left= ((viewportwidth - parseInt(tag.style.width))/2) + parseInt(tag.style.marginLeft) - parseInt(tag.style.marginRight) + "px";
}
if ( align=="top" ){
tag.style.top=parseInt(tag.style.marginTop) + "px";
tag.style.bottom= viewportheight - (parseInt(tag.style.bottom) + parseInt(tag.style.marginTop)) + "px";
} else if ( align=="bottom" ){
tag.style.bottom=parseInt(tag.style.marginTop) + "px";
tag.style.top=viewportheight - (parseInt(tag.style.width) + parseInt(tag.style.marginBottom)) + "px";
} else if ( align=="vcenter" ){
tag.style.bottom= ((viewportheight - parseInt(tag.style.width))/2) - parseInt(tag.style.marginTop) + parseInt(tag.style.marginBottom) + "px";
tag.style.top= ((viewportheight - parseInt(tag.style.width))/2) + parseInt(tag.style.marginTop) - parseInt(tag.style.marginBottom) + "px";
}
return;
}


setInterval('XHTMLAlign("divid", "center")', 100);
setInterval('XHTMLAlign("divid", "vcenter")', 100);

View 2 Replies View Related

Xhtml Complient Javascript

Aug 6, 2004

the following line is erroring in an xhtml validator:

var ns6clock=document.getElementById && !document.all

the && is erroring, but I cant work out how to change it eg to the ascci value? Code:

View 10 Replies View Related

Javascript In Xhtml Strict

Jul 11, 2002

does anyone know of any sites that use (validating) xhtml strict, and also use javascript functions - rollovers etc?

(the strict dtd won't allow you to use the "name" attribute, in images, so I want to find out what the solution is to this problem)

View 4 Replies View Related

XHTML-compliant Document.write

May 10, 2006

How can I make an XHTML-compliant form of an expression in this
format:

document.write("<scr"+"ipt type='text/javascript' src='path/to/file.js'>"+"</scr"+"ipt>");

this turns out to be a non-trivial exercise. inserting '&lt;' and
'&gt;' causes the browser to write the text to the page as literal
text rather than as the intended script element. Using escape codes
seemed to work (makes it standard compliant) but the text is not
written to the page.

The point is to have a conditional branch in which, when a certain
condition is true, a script tag will be generated that will call a
JS include that responds to the specific condition.

This procedure works in the present implementation -- but fails XHTML
compliance testing. Now, we would like to have both.

View 11 Replies View Related

Document.createElement Is Not XHTML Standard

Jan 2, 2007

I've been creating a script that dynamic loads js files.

but after creating that script, (and i use
document.createElement('script');) in that function.. i've realise that
the code that shows up in the browser is:

<script type="text/javascript">

should it be

<script type="text/javascript" />

or

<script type="text/javascript"></script>

View 4 Replies View Related

Whole Layout Messes Up - Xhtml Will Not Allow </script>

Apr 8, 2010

The Problem: I have the following code in my head section of my page:

<script type="text/javascript" src="js/random-testimonial.js"></script>

However xhtml will not allow </script> so to counter this I try to make the code into this:

<script type="text/javascript" src="js/random-testimonial.js" />

Thing is, when I do that, my whole layout messes up, it's as if it is ignoring my stylesheet when it is in the php version of the site, when it is in a normal html file, it pushes my main container to the left and then you can not see the header container properly, only a little bit of it. Everything seems to work fine if I keep it the code like the first shown here but I can not have it like that for xhtml, is there something I am missing here?

View 6 Replies View Related

Xhtml Doctype And Form Name Attribute?

Aug 21, 2010

I have been attempting to transition to use of xhtml strict doctype andmy text editor, BBEdit (on Mac) tells me, when I ask it to check syntax,that the attribute 'name' is not allowed in form object, as in any otherform element that I tried to use it in. This begs the question, how doI script forms with javascript in the context of this doctype? None ofthe javascript texts I have address this issue (O'Reilly Rhino book andothers).I could figure it out, but it appears to be a complicated process, justdoing getElementById() and sorting it out.Does anyone have a reference to material that deals with this issue?

View 2 Replies View Related

Xhtml Page Gives Syntax Error In Ie6

Jan 23, 2004

I've done my first public XHTML / CSS page, and it looks fine, but in IE6 there's an error message when the page is first loaded that says there's a syntax error in line 2. If I reload the page the error message disappears. I don't have an XML prolog, just

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

Any ideas?

View 3 Replies View Related

Separating Behavior(js) From Structure(xhtml)

Sep 29, 2004

I was reading Peter-Paul Koch's article about how to separate javascript from the html and put it in another file:

http://www.digital-web.com/articles/...d_structure_2/
but I can't get it to work(IE6 and Firefox1.0 on windows). Here is my html file:

Code:

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en">

<head>
<title>Web Design 1</title>
<meta name="author" content="Mr. Smith, I presume" />
<meta name="description" content="web" />

<script src="mouseovers.js" type="text/javascript"></script>
</head>

<body>

<div><img id="mouseover_effect" src="green_square.jpg" /></div>

</body>
</html>
and here is my mouseovers.js file:


Code:
function initializeMouseOvers(){

var images=document.getElementsByTagName("img");
var c=images.length;

for(var ii=0; ii < c; ii++){
images[ii].onMouseOver=mouseover;
}

}

function mouseover(){
this.src="red_square.jpg"
}

window.onload=initializeMouseOvers;

A green square displays, but I don't get any rollover effect--I'm trying to get the green square to switch to a red square.

View 4 Replies View Related

Reset Working In HTML 4.0 But Not XHTML

May 2, 2010

Why my script is working in an HTML 4.0 doc but not in XHTML. When I have it in XHTML and click the reset button it does reset the form but not the table. If I have it in HTML doc it resets both the table and the form.

Here is my code for the form (the part that is affected by the reset.)

This is for a class and they are requiring it to be XHTML..

You can see the it here: [url]

HTML Code:

This is the actual button

HTML Code:

And here is the script

Code:

View 4 Replies View Related

Move An Image - Not Working With XHTML Doctype ?

Jan 12, 2010

I'm trying to move an image with the following JS function, but it only seems to work when I remove the XHTML doctype from the top of the document.

Here's the javascript:

Code:

I read something about this on another forum and I think it has something to do with the declaration of obj.style.top, but I can't find a solution. I've tried creating a new variable that contains "document.getElementByID(obj)" and then using that variable to change the top of the image, but it still doesn't work.

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved