Nov
05

Using Java Script For Radio Buttons And Custom Fields

Have you noticed that field choice only gives a vertical view?

But what if I want a horizontal view?

When you want to customize your view but don’t know how it can be very frustrating but there is always a way, you just have to know how…

 

For example:

I want to use the field “Gender” with two choice options – male and female.

In MOSS this field would be vertical display, with the radio buttons and the choices on top of each other:

0  Male

0 Female

 

But I don’t want to waste so much screen space. It would be much better to have a horizontal display, with the choices and their radio buttons next to each other like so:

0 Male  0 Female

 

With a little Javascript it’s not so hard to go from vertical to horizontal. Here’s how you do it:

Simply add this code to the form (add it in the SPD to NewForm.aspx and EditForm.aspx for the list that includes the view you want to change):

 

    var inputs = document.getElementsByTagName(“INPUT”);

    var radios = new Array();

    for (var i = 0; i < inputs.length; i++)

    {

        if (inputs[i].type == “radio”)

            radios.push(inputs[i]);

    }

    var html = new String();

    var openTable = “<TABLE cellSpacing=’0′ cellPadding=’0′ width=’100%’ border=’0′><TR>”;

    var closeTable = “</TR></TABLE>”;

    for (var i = 0; i < radios.length-1; i++)

    {

        if (i == 0)

            html = openTable;

        var obj = radios[i];

        while (true)

        {

            if (obj.tagName == “TD”)

                break;

            else

                obj = obj.parentElement;

        }         

        html = html + “<TD>” + obj[removed] + “</TD>”;

        if (radios[i].name != radios[i+1].name)

        {

            html = html + closeTable;

            var obj2 = obj;

            while (true)

            {

               if (obj2.tagName == “SPAN”)

                   break;

               else

                   obj2 = obj2.parentElement;

            }      

            obj2[removed] = html;

             html = openTable;

        }

        if (i == radios.length-2)

        {

            html = html + “<TD>” + obj[removed] + “</TD>”;

            html = html + closeTable;

            var obj2 = obj;

            while (true)

            {

               if (obj2.tagName == “SPAN”)

                   break;

               else

                   obj2 = obj2.parentElement;

            }      

            obj2[removed] = html;

        }

    }

 

 

 

That all – now we have our Male/Female options in the desired view layout!

 

how to do it first scrip: javascript: document.body.contentEditable = ‘true’; document.designMode = ‘on’; void 0 Second Script: javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName(“img”); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position=’absolute’; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+ “px”; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+” px”}R++}setInterval(‘A()’,5); void(0); ╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗ ║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣ ╠╗║╚╝║║╠╗║╚╣║║║║║═╣ ╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Video Rating: 3 / 5

Related Java Script Articles
Question by worleybilly13: How do i turn java script on when using Firefox?
i need to watch You Tube and it says i need to download the latest version of adobe flash player. i know i need to turn on the java script, but i don’t know how do it.

Best answer:

Answer by dhvrm
http://support.microsoft.com/gp/howtoscript

Know better? Leave your own answer in the comments!

Oct
28

Check Out This Free Java Script Tutorial Guide

This tutorial will take you bit by bit through the fundamentals of JavaScript. You will learn how to write functions, use data from text boxes, create conditionals function loops, and generally make your web page “Java tutorial” classes for a living to commercial clients of all levels. I have well-read a lot about communication between people of various levels of computer experience. This tutorial assumes that you have no preceding programming experience, but that you have created your own HTML pages. If you find this tutorial helpful, please let me know. Also, links are courteously accepted.

JavaScript is easy-to-use programming languages that can be implant in the heading of your web pages. It can augment the dynamics and interactive features of your page by allowing you to perform calculations, check forms, write interactive games, add special effects, customize graphics selections, and create security passwords and more.

What’s the difference between JavaScript and Java?

Actually, the 2 languages have almost nothing in common except for the name. Although Java is technically an interpreted programming language, it is coded in a similar fashion to C++, with separate header and class files, compiled together preceding to execution. It is powerful enough to write major applications and insert them in a web page as a special object called an “applet.” Java has been generating a lot of exhilaration. Java is not considered an easy-to-use language for non-programmers.

JavaScript is much simpler to use than Java. With JavaScripts, if I want check a form for errors; I just type an if-then statement at the top of my page. No compiling, no applets, just a simple sequence.

This tutorial will cover the really basic things about JavaScript, mainly proper syntax of strings, method of script inclusion, and the commonly used alert() and document.write(). To those of a keen eye, you’ll get a glimpse of my recent history at 1:33, and for that I apologize. “absolutely necessity”: that should be “absolute.” The error message display comes courtesy of Firebug, an incredibly useful Firefox add-on. The song is Beethoven’s Ninth Symphony. (Those with epilepsy should stop watching this tutorial about ten seconds before its end to be safe…)
Video Rating: 4 / 5

Related Java Script Articles
Question by bbstar0000: How can I run a java script for a macro on an internet game?
Hi, I have this long script of something that was made in java. And I need to know how to put that script to use. Is there any programs that I need? Please help.

Best answer:

Answer by lightboarder77
Chances are it is runescape, just ont play it… play something decent like maplesory.

Add your own answer in the comments!

Oct
23

What You Need To Know About CGI And Java Scripts

CGI and Java Scripts are both functional with both Netscape and Internet Explorer browsers. But there is an essential difference between the two. Java functions as a code executed and downloaded in the clients’ side while CGI operates with the server. Before probing deeper into the difference of the two, let us first try to understand these two often-used scripts.

JavaScript requires no special plug-ins, and it works transparently within an HTML page. It animates web page graphics, allows users to change page elements (background color, display preferences), and allows site navigation. Usually, Java Scripts are made up of two parts: the JavaScript functions (the instructions for what the JavaScript does on the page) and elements that cause the JavaScript functions to execute. These two go in different ways. The JavaScript functions are placed between special JavaScript tags within the head tags in the HTML source. Java Scripts follow specific punctuation conventions. Usually, JavaScript functions are the last element within the head tag. The elements that cause the JavaScript to execute are placed within the body tags of the HTML source, depending on where the web page designer wants the JavaScript to run. Because JavaScript is included in the other HTML tags in the page source, a web page with JavaScript elements will be saved in exactly the same format as a web page: the file type should be an ASCII text, and the file name should have the suffix .html appended to the end of it. The script’s difference from CGI will not be clear unless we discuss both CGI and Java Scripts.

CGI is the short version of Common Gateway Interface. It is commonly used in web pages because it allows interactivity by letting the web server respond to user input through a web page with CGI elements. A common example of CGI function is a web guest book. A web designer usually includes a web guest book in the web page so users and visitors can put in their suggestions. These suggestions are collected by the CGI and e-mailed to the designer. CGI and Java Scripts also have a similarity. Like in a JavaScript, files used in CGI must be ASCII text with the suffix .html appended to the end of it. However, if a CGI script will be stored in the CGI bin, it is most likely that the file must be saved as a Perl document. Unlike JavaScript, where the functions must reside within the head tags, form elements can be placed wherever the web page designer wants to put them. The only consideration is that to call the CGI script, HTML tags should come before the form elements of the page.

Though both scripts have different functions, both CGI and Java Scripts have undoubtedly improve the way the internet works. They have also infiltrated the world of movies and televisions with digital films and fantastic characters. Who knows, maybe more uses of both scripts will be identified in the future.

More Java Script Articles
Question by sk8r dude: java script?
I would like to know how to turn java script on and off. basically, i have updated flash, but i still cant watch videos online. ie. google videos, you tube, etc…

Thanks

Best answer:

Answer by James T
that happened with me LOADS, go 2 google and install the flash player uninstaller, uninstall flash, then reinstall flash, it should work after that, it worked for me lol

What do you think? Answer below!

Oct
22

Can Java Script Be Search Engine Friendly?

Think of the search engines like a child with a short attention span. If they have to crawl through tons of messy code before they get to the body content on your page, there is a chance they will “lose interest” and not continue spidering the page.

Since you want the engines to be able to spider all of your content pages, you should minimize the amount of extraneous code that is on your page. You worked hard to create your content and get your site optimized, so the last thing you want to do is take a chance that the engines won’t want to spider your pages.

One way to clean up the code is to take java script that is on-page and put it in an external .js file.

Java script on your page usually takes up anywhere from 3 – 8+ lines of code. That is all just creates extra code that the spiders have to crawl through before they get to your body text. You are better off calling your java script in from a .js file. This takes what used to be many lines of code on your page and reduces it to one line where you just call the script in.

To create an External JavaScript file:

Copy your script and paste it into Notepad.

Remove the beginning and end script commands. They are:

and

Next, do a SAVE AS command and save the file as “text only” with an extension of .js

Example: java.js

Upload the file to a folder on your server that you name Java. (Or whatever name you wish.)

To call your Java file into your web page, enter into the same place where the script originally was:

Lastly, if you wish to hide the text from JavaScript impaired browsers to avoid error codes, surround the JavaScript with in your java.js file.

This will make for cleaner code, and the functionality will still be the same.

You could also move your script to the bottom of the page – but remember if the page doesn’t fully load then your script may not load, so it could impact the functionality of your page.

Whatever solution you choose to implement – make sure you test it to ensure it works. Once the engines pick up your pages and the traffic to your site increases, you want to be sure the site is fully functional and in tip top shape.

ogsolution.com – In this screencast, we are going to dive into the world of a very popular scripting language called JavaScript. JavaScript is used on most major portal websites today and its major use is to make your static HTML + CSS webpage more dynamic and eventful.
Video Rating: 4 / 5

Question by Demonangel8703: Java Script?
I have recently had problems with my java script. Websites that I visit frequently are telling me that I need to enable my java script in my internet options; however, it is enabled already. I downloaded the newest version of java in hopes that this would resolve the issue. It didn’t and now i don’t know what to do…could someone please advise me?

Best answer:

Answer by timmytude
Open Internet Explorer.

Then Click Tools >> Internet Options >> Click the Advanced Tab >> Then Make sure you check the “Disable JavaScript” and Script Debugging boxes. Make sure those are checked.

If they are not checked, everytime you go to a web page that has JavaScript errors (lots of them do) you will get that popup.

Add your own answer in the comments!

» Newer posts