Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › program a simple HTML code
New Posts  All Forums:Forum Nav:

program a simple HTML code

post #1 of 13
Thread Starter 
How guys I need help with a simple piece of HTML code:
I a typeable box, that you type a URL in. Then you press the "Go" button and you are redirected to the URL that was typed in, except, with this in front of the URL:
Code:
http://www.google.com/translate?langpair=en|en&u=
Rig 2.1
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i7 3770k ASUS P8Z77-V LK Sapphire 7850 1GB G.SKILL Ripjaws X 8GB (2 x 4GB) DDR3 F3-12800CL... 
Hard DriveHard DriveOptical DriveCooling
Western Digital Blue 1TB WD10EZEX Search Results Crucial MX100 CT256MX100SSD1 256GB ASUS DRW-24B1ST DVD±R/RW Zalman CNPS10X Optima 
OSMonitorKeyboardPower
Windows 7 Ultimate 64-bit Dell 23" IPS CM Storm Quick Fire Pro Brown OCZ StealthXStream 600W 
CaseMouseAudio
Antec P182 Logitech MX518 Logitech X-530 
  hide details  
Reply
Rig 2.1
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i7 3770k ASUS P8Z77-V LK Sapphire 7850 1GB G.SKILL Ripjaws X 8GB (2 x 4GB) DDR3 F3-12800CL... 
Hard DriveHard DriveOptical DriveCooling
Western Digital Blue 1TB WD10EZEX Search Results Crucial MX100 CT256MX100SSD1 256GB ASUS DRW-24B1ST DVD±R/RW Zalman CNPS10X Optima 
OSMonitorKeyboardPower
Windows 7 Ultimate 64-bit Dell 23" IPS CM Storm Quick Fire Pro Brown OCZ StealthXStream 600W 
CaseMouseAudio
Antec P182 Logitech MX518 Logitech X-530 
  hide details  
Reply
post #2 of 13
This should work for you. I added a section to select the "to" language. It assumes that english is the input. There is enough code there for you to add in a user adjustable "from" language if you try.

Code:

<HTML>
<HEAD>
<TITLE>Internet Redirector</TITLE>
</HEAD>
<BODY>
<script language="JavaScript">
function GoTranslate(strIn)
{
var tUrl = 'http://www.google.com/translate?langpair=en|' + WhatLanguageTo() + '&u=' + strIn;
var oWindow = NewWindow();
oWindow.location = tUrl;

 
function WhatLanguageTo()
{
var tRet = document.frmUrl.toLanguage[document.frmUrl.toLanguage.selectedIndex].value;
return tRet;
}
 
function NewWindow()
{
var tRet = window.open("", "newWindow") 
return tRet
}
</script>
 
<form name="frmUrl">
<select name="toLanguage">
<option value="en">English</option> 
<option value="fr">French</option> 
<option value="es">Spanish</option> 
<option value="it">Italian</option> 
<option value="pt">Portuguese</option> 
<option value="de">German</option> 
<option value="ko">Korean</option> 
<option value="ja">Japanese</option> 
<option value="zh-CN">Chinese (Simp)</option> 
<option value="ar">Arabic</option> 
</select>
<br>
<input name="txtUrl" type="text" length="55">
<input type="Button" value="Go" onClick="GoTranslate(document.frmUrl.txtUrl.value);">
</form>
 
</BODY>
</HTML> 
EDIT: This isn't PHP, just wanted the syntax colored. Paste this into a text doc and change the extension to "html" or "htm".
Main Rig
(15 items)
 
  
Reply
Main Rig
(15 items)
 
  
Reply
post #3 of 13
Thread Starter 
It doesn't seem to work.
and btw, I don't need the "to" part, so can you take it out so the vistors are confused? yes I know it's tranlating english to english
Rig 2.1
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i7 3770k ASUS P8Z77-V LK Sapphire 7850 1GB G.SKILL Ripjaws X 8GB (2 x 4GB) DDR3 F3-12800CL... 
Hard DriveHard DriveOptical DriveCooling
Western Digital Blue 1TB WD10EZEX Search Results Crucial MX100 CT256MX100SSD1 256GB ASUS DRW-24B1ST DVD±R/RW Zalman CNPS10X Optima 
OSMonitorKeyboardPower
Windows 7 Ultimate 64-bit Dell 23" IPS CM Storm Quick Fire Pro Brown OCZ StealthXStream 600W 
CaseMouseAudio
Antec P182 Logitech MX518 Logitech X-530 
  hide details  
Reply
Rig 2.1
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i7 3770k ASUS P8Z77-V LK Sapphire 7850 1GB G.SKILL Ripjaws X 8GB (2 x 4GB) DDR3 F3-12800CL... 
Hard DriveHard DriveOptical DriveCooling
Western Digital Blue 1TB WD10EZEX Search Results Crucial MX100 CT256MX100SSD1 256GB ASUS DRW-24B1ST DVD±R/RW Zalman CNPS10X Optima 
OSMonitorKeyboardPower
Windows 7 Ultimate 64-bit Dell 23" IPS CM Storm Quick Fire Pro Brown OCZ StealthXStream 600W 
CaseMouseAudio
Antec P182 Logitech MX518 Logitech X-530 
  hide details  
Reply
post #4 of 13
Quote:
Originally Posted by bentrinh
It doesn't seem to work.
and btw, I don't need the "to" part, so can you take it out so the vistors are confused? yes I know it's tranlating english to english
What are you doing to make it work? I tested it and it works fine for me.

Ben, the example is simple enough that you should be able to figure out how to remove that part. If you are unsure, just keep looking at each line and figure out what the small parts do. Once you have that done, then removing that section should be a peice of cake.
Main Rig
(15 items)
 
  
Reply
Main Rig
(15 items)
 
  
Reply
post #5 of 13
Works for me also (do you mind if i use this, i was looking for somewhat of the same thing, ill just tinker around with it.
Doesn't suck
(12 items)
 
XPS L702X
(9 items)
 
 
CPUMotherboardGraphicsRAM
i7 4770s 3.1Ghz Gigabyte B85M-D3V RX480 8gb 16GB 
Hard DriveOptical DriveCoolingOS
128GB SanDisk SDSSDHP128G Matshita DVD-Ram Stock Windows 10 Pro 
KeyboardPowerCaseMouse
G19 APEVIA ATX-AP900W Cooler Master Microsoft Optical Wheel Mouse 
CPUGraphicsRAMHard Drive
Intel Core i7-2670QM GT555M 8GB  2 x Seagate 7200RPM 500GB 
Optical DriveOSMonitorKeyboard
BluRay combo drive Windows 7 Premium 17" Laptop + 24" 1920x1080 Dell Backlit laptop keyboard 
Case
XPS L702X 
  hide details  
Reply
Doesn't suck
(12 items)
 
XPS L702X
(9 items)
 
 
CPUMotherboardGraphicsRAM
i7 4770s 3.1Ghz Gigabyte B85M-D3V RX480 8gb 16GB 
Hard DriveOptical DriveCoolingOS
128GB SanDisk SDSSDHP128G Matshita DVD-Ram Stock Windows 10 Pro 
KeyboardPowerCaseMouse
G19 APEVIA ATX-AP900W Cooler Master Microsoft Optical Wheel Mouse 
CPUGraphicsRAMHard Drive
Intel Core i7-2670QM GT555M 8GB  2 x Seagate 7200RPM 500GB 
Optical DriveOSMonitorKeyboard
BluRay combo drive Windows 7 Premium 17" Laptop + 24" 1920x1080 Dell Backlit laptop keyboard 
Case
XPS L702X 
  hide details  
Reply
post #6 of 13
Thread Starter 
It doesn't work for me...
Rig 2.1
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i7 3770k ASUS P8Z77-V LK Sapphire 7850 1GB G.SKILL Ripjaws X 8GB (2 x 4GB) DDR3 F3-12800CL... 
Hard DriveHard DriveOptical DriveCooling
Western Digital Blue 1TB WD10EZEX Search Results Crucial MX100 CT256MX100SSD1 256GB ASUS DRW-24B1ST DVD±R/RW Zalman CNPS10X Optima 
OSMonitorKeyboardPower
Windows 7 Ultimate 64-bit Dell 23" IPS CM Storm Quick Fire Pro Brown OCZ StealthXStream 600W 
CaseMouseAudio
Antec P182 Logitech MX518 Logitech X-530 
  hide details  
Reply
Rig 2.1
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i7 3770k ASUS P8Z77-V LK Sapphire 7850 1GB G.SKILL Ripjaws X 8GB (2 x 4GB) DDR3 F3-12800CL... 
Hard DriveHard DriveOptical DriveCooling
Western Digital Blue 1TB WD10EZEX Search Results Crucial MX100 CT256MX100SSD1 256GB ASUS DRW-24B1ST DVD±R/RW Zalman CNPS10X Optima 
OSMonitorKeyboardPower
Windows 7 Ultimate 64-bit Dell 23" IPS CM Storm Quick Fire Pro Brown OCZ StealthXStream 600W 
CaseMouseAudio
Antec P182 Logitech MX518 Logitech X-530 
  hide details  
Reply
post #7 of 13
Quote:
Originally Posted by bentrinh
It doesn't work for me...
I ask again, what are you doing to try and make it work?
Main Rig
(15 items)
 
  
Reply
Main Rig
(15 items)
 
  
Reply
post #8 of 13
Thread Starter 
Quote:
Originally Posted by BFRD
I ask again, what are you doing to try and make it work?
I copied it, renamed it to a .html file and uploaded as index.html
Rig 2.1
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i7 3770k ASUS P8Z77-V LK Sapphire 7850 1GB G.SKILL Ripjaws X 8GB (2 x 4GB) DDR3 F3-12800CL... 
Hard DriveHard DriveOptical DriveCooling
Western Digital Blue 1TB WD10EZEX Search Results Crucial MX100 CT256MX100SSD1 256GB ASUS DRW-24B1ST DVD±R/RW Zalman CNPS10X Optima 
OSMonitorKeyboardPower
Windows 7 Ultimate 64-bit Dell 23" IPS CM Storm Quick Fire Pro Brown OCZ StealthXStream 600W 
CaseMouseAudio
Antec P182 Logitech MX518 Logitech X-530 
  hide details  
Reply
Rig 2.1
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i7 3770k ASUS P8Z77-V LK Sapphire 7850 1GB G.SKILL Ripjaws X 8GB (2 x 4GB) DDR3 F3-12800CL... 
Hard DriveHard DriveOptical DriveCooling
Western Digital Blue 1TB WD10EZEX Search Results Crucial MX100 CT256MX100SSD1 256GB ASUS DRW-24B1ST DVD±R/RW Zalman CNPS10X Optima 
OSMonitorKeyboardPower
Windows 7 Ultimate 64-bit Dell 23" IPS CM Storm Quick Fire Pro Brown OCZ StealthXStream 600W 
CaseMouseAudio
Antec P182 Logitech MX518 Logitech X-530 
  hide details  
Reply
post #9 of 13
Quote:
Originally Posted by bentrinh
I copied it, renamed it to a .html file and uploaded as index.html
Can you send me the link or the exact file you uploaded? I have tested in both FF and IE, are you possibly using something else?
Main Rig
(15 items)
 
  
Reply
Main Rig
(15 items)
 
  
Reply
post #10 of 13
Thread Starter 
Quote:
Originally Posted by BFRD
Can you send me the link or the exact file you uploaded? I have tested in both FF and IE, are you possibly using something else?
here's a URL: www.geocities.com/bentrinh102/
Rig 2.1
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i7 3770k ASUS P8Z77-V LK Sapphire 7850 1GB G.SKILL Ripjaws X 8GB (2 x 4GB) DDR3 F3-12800CL... 
Hard DriveHard DriveOptical DriveCooling
Western Digital Blue 1TB WD10EZEX Search Results Crucial MX100 CT256MX100SSD1 256GB ASUS DRW-24B1ST DVD±R/RW Zalman CNPS10X Optima 
OSMonitorKeyboardPower
Windows 7 Ultimate 64-bit Dell 23" IPS CM Storm Quick Fire Pro Brown OCZ StealthXStream 600W 
CaseMouseAudio
Antec P182 Logitech MX518 Logitech X-530 
  hide details  
Reply
Rig 2.1
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i7 3770k ASUS P8Z77-V LK Sapphire 7850 1GB G.SKILL Ripjaws X 8GB (2 x 4GB) DDR3 F3-12800CL... 
Hard DriveHard DriveOptical DriveCooling
Western Digital Blue 1TB WD10EZEX Search Results Crucial MX100 CT256MX100SSD1 256GB ASUS DRW-24B1ST DVD±R/RW Zalman CNPS10X Optima 
OSMonitorKeyboardPower
Windows 7 Ultimate 64-bit Dell 23" IPS CM Storm Quick Fire Pro Brown OCZ StealthXStream 600W 
CaseMouseAudio
Antec P182 Logitech MX518 Logitech X-530 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › program a simple HTML code