473,394 Members | 2,100 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,394 software developers and data experts.

Javascript not working with XHTML DTD

wrote a javascript and it never worked until i removed the
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2.   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
i thought this is a standard and wonder why i have to remove it before mycode will work
am using dreamweaver 8
any help?
Sep 8 '09 #1
11 2906
Dormilich
8,658 Expert Mod 8TB
the only problem I ever had with Javascript and a XHTML DTD is that Firebug complains about a missing semi-colon (which doesn’t make sense and I always can safely ignore this error)

btw. is it not working in dreamweaver or not working in the browser?
Sep 8 '09 #2
RamananKalirajan
608 512MB
Are you using any JS Framework with your code.. like ExtJS or Jquery?

Thanks and Regards
Ramanan Kalirajan
Sep 8 '09 #3
acoder
16,027 Expert Mod 8TB
For any new pages, you should be using strict except in a few cases. Also, are you really using XHTML or HTML? Post your JavaScript code or explain what was not working.
Sep 8 '09 #4
Expand|Select|Wrap|Line Numbers
  1. function show(menu){
  2.    if(menu.style.display="none"){
  3.        menu.style.display="";
  4.    }else{
  5.             menu.style.display="none";
  6.           }
  7. }
  8.  
i dont think there is anything special here
Sep 9 '09 #5
Dormilich
8,658 Expert Mod 8TB
@freefony
is the assignment here intended?
Sep 9 '09 #6
yes i want the display to be none on page load is there a better way?
Sep 9 '09 #7
Dormilich
8,658 Expert Mod 8TB
use the window.onload event or a CSS default value.

Expand|Select|Wrap|Line Numbers
  1. menu.style.display="";
is not valid CSS. should be one of "block", "inline", "inline-block", … but certainly not "".

your show() function will always set the display style to "", no matter which value it had before.
Sep 9 '09 #8
thanks for that it helps . but please if u do php what is the javascricpt equivelent for ? and | location am working on a frameset with 3 windows 1search window 2.design window and 3. result window . something like this
Expand|Select|Wrap|Line Numbers
  1. var regno= this.document.forms[0].reg.value;
  2. <input type="button" id="regno" onclick="result.src='result.php?regno=regno'"/> 
  3.  
the src of the result window is dynamic and can display other documents
Sep 9 '09 #9
Dormilich
8,658 Expert Mod 8TB
@freefony
what is that supposed to mean?
Sep 9 '09 #10
in php i will do this when the button is click
Expand|Select|Wrap|Line Numbers
  1. header("location:result.php?regno=$regno");
  2.  
but i want javascript to do this with an onclick event of a button
Sep 9 '09 #11
Dormilich
8,658 Expert Mod 8TB
use location.href

___
Sep 9 '09 #12

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

Similar topics

9
by: Charlene Russ | last post by:
Learn on-line at your own in a user-centered format with plenty of interaction and personal attention. This is a basic level coursed designed to introduce the novice to intermediate computer...
4
by: CB US 77 | last post by:
I use a piece of javascript to create a photo gallery slideshow. The slideshow part works great, but I would like to add captions to each picture. If you want to see the html, send me an email to...
23
by: ivan | last post by:
AJAX is a stupid and confusing word. People is wondering for something that programmers have used for many years. Javascript + Xml and asynchronous requests is not new. People started to speak...
6
by: ged | last post by:
Hi, i am a oo (c#) programmer, and have not used javascript for a while and i cant work out how javascript manages its references. Object References work for simple stuff, but once i have an...
3
by: Crazy Code Ninja | last post by:
Hi, I created a page with xhtml 1.0 transitional dtd, its validated correctly, but now the javascript wouldn't work under Opera (version 8.5 I think). It works under firefox. My code is as...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
11
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or...
2
by: William van Zwanenberg | last post by:
Hi there, I wonder if you guys can help. I'm currently experiencing some coding problems what with trying to use PHP and javascript in tandem. What I'm ultimately trying to achieve is use...
12
by: Manfred Kooistra | last post by:
I have a problem with some JavaScript code not working. I'm sure I've done something obviously stupid, but I can't for the live of me figure it out. Can someone please help? This is the XHTML...
2
by: Holger Jeromin | last post by:
Hello, i need to add SVG things direct in a Website. I know XHTML is best used for that, with works nice in Firefox and Opera. Internet Explorer is more challenging... I have ported my...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.