Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
figmentthinking #1
Add JavaScript Code to head
We use a customized button for submitting forms or links at work. The code
combines DHTML elements for the look and functionality of the button. I've
created an extension, and it adds the HTML and CSS code, but when I try to add
the JavaScript, I get an error because DreamWeaver tries to parse the
JavaScript as a part of the extension.
I can't figure out how to get the JavaScript into the <head> of the document
like the CSS. I've looked at numerous functions and I just can't find enough
documentation to get a full understanding. Any help is greatly appreciated.
figmentthinking Guest
-
add some code to the page <HEAD>
Is it possible that my user control can add code to the HEAD of the parent page that hosts the control? -
Insert Code Into Head
Hi, I just started creating my own extensions. I'm just wondering how I can make an object extension insert code into multiplae areas of the... -
writing dynamic .css into head tag with javascript
Hello! I have a problem regarding writing to head tag. Here is the situation: I have a page with link tag that points to .css which has screen... -
Code into head tag
Here's a way to get a Title into the Head section using code behind: How do I set the title of an aspx page programmatically... -
Injecting code into the <head></head> section
Hi All, I have a web user control that, among other things, provides Print this page, and Email this page functionality I have this script that... -
E Michael Brandt #2
Re: Add JavaScript Code to head
figmentthinking wrote:
> We use a customized button for submitting forms or links at work. The code
> combines DHTML elements for the look and functionality of the button. I've
> created an extension, and it adds the HTML and CSS code, but when I try to add
> the JavaScript, I get an error because DreamWeaver tries to parse the
> JavaScript as a part of the extension.
>
> I can't figure out how to get the JavaScript into the <head> of the document
> like the CSS. I've looked at numerous functions and I just can't find enough
> documentation to get a full understanding. Any help is greatly appreciated.
>
You have not given much to go on, but it might be that you did not
realize that any '</script>' tags needed to be masked from DW Extension
API by breaking them up into '</scr'+'ipt>'
--
E. Michael Brandt
[url]www.divahtml.com[/url]
[url]www.divahtml.com/products/scripts_dreamweaver_extensions.php[/url]
Standards-compliant scripts and Dreamweaver Extensions
[url]www.valleywebdesigns.com/vwd_Vdw.asp[/url]
JustSo PictureWindow
JustSo PhotoAlbum, et alia
--
E Michael Brandt Guest
-
figmentthinking #3
Re: Add JavaScript Code to head
Michael,
Thanks for the reply. I find the documentation lacking, I can concede that
maybe it's my understanding of what's provided, but more explanation would be
better.
Simply put, I have a css that needs to be in the style tags and JavaScript
that needs to be in the head, and HTML that needs to be in the body tag.
Leaving the JS out of the equation, my simple .htm file with the CSS and HTML
find their appropriate spots in the doucment I'm working on.
I attempted to escape the closing script tag in the .htm file , but that
doesn't work (this is where I think the documentation should explain that has
to be in a .js file) , but documentation also lacks in how to get the data from
the JS file back into the document.
I think my biggest issue is that I'm working from with in the DW API, which
could be programmed to do what ever they want it to do, and knowing this I'm
leaving the normal thought process of HTML and JavaScript, and I'm trying to
guess a what could be.
I've managed to copy code and get a positive result, but it looks like I'm
going to have to recode the entire .htm file and pass it as a string to the
JavaScript so it will return all 3 DHTML elements to the document. That just
seems like too much work.
figmentthinking Guest
-
E Michael Brandt #4
Re: Add JavaScript Code to head
You have not said, but I gather you are using the Command API, which is
the most flexible and powerful of the three: Behavior, Object and
Command APIs.
With that API, you can simply add to the innerHTML of the Head (or the
"head" Editable Region of a Child page, or NOT the "head" editable
region of a Template) a string containing your new script, as long as
you break up the </script> tag. To be safe I often break up the opening
<script> tag too.
So, for example:
var str='<scr'+'ipt type="text/javascript"> blah blah</scr'+'ipt>';
var head=dw.getDocumentDOM().getElementsByTagName('HEA D')[0];
head.innerHTML=head.innerHTML+str;
--
E. Michael Brandt
[url]www.divahtml.com[/url]
[url]www.divahtml.com/products/scripts_dreamweaver_extensions.php[/url]
Standards-compliant scripts and Dreamweaver Extensions
[url]www.valleywebdesigns.com/vwd_Vdw.asp[/url]
JustSo PictureWindow
JustSo PhotoAlbum, et alia
--
E Michael Brandt Guest



Reply With Quote

