Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9169475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:53:04+00:00 2026-06-17T15:53:04+00:00

I want to add an input field the user can enter/modify an IP Address

  • 0

I want to add an input field the user can enter/modify an IP Address in the format 198.162.0.0/45 representing a range from 198.162.0.0 – 198.162.0.45

what I have almost works but its not allowing the complete correct format. If I enter any of the following it works fine.
198/45, 198.168, or 198.168.0.45

but as soon as I try to add
198.168.0/24 or 198.168.0.0/24

I wanted to be able to add 198.168.0.0/24 without having to breakup the fields but if I have to I can.

it gets a scripting error when my dynamic element is appended to the div tag containing the input fields.

basically my setup is this, empty div tag I will append the following to. The newIpRange comes in as a string such as 198.168.0.0/24
EDIT with test html that produces the issue

<html>
<head>
<title>Test IP</title>

<script type="text/javascript">

function onload(range){

var e = document.getElementById("_main");
e.innerHTML = getTag(range);

}

function getTag(range){
return "<div class='input-append'  ><input  type='text' value='" + range + "' ></input><div>";
}

</script>
</head>
<body onload="onload(198.168.1.0/24);">
<div id="_main" >

</div>
</body>
</html>

what would be causing this? of interest to me really is why does it give the error in some cases, not others

Here is the Error I’m getting from the script when I appent this line: SCRIPT1006: Expected ‘)’

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:53:04+00:00Added an answer on June 17, 2026 at 3:53 pm

    After spending a little time with the sample I made I finally came to the realization, its how javascript is parsing the values.

    in the case of 10.12/24 its evaluating it as a number with a division
    as soon as I add the extra period in there it can no longer evaluate it as a number, to solve that putting it in a string literal cleans everything up!

    to fix this I put the ipcallback into a pair of single quotes to tell javascript its a string

    <script>
    </head>
    <body onload="onload('198.168.1.0/24');">
    <div id="_main" >
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am want to have a input box, where a user can add or
I just want to add some extra text on top of input posted from
I want to make an input form in Java so that the user can
I want to provide a user-input field in my iPad app, where the user
I want to add a class to certain input or label elements in a
I want to add a background color to the container(div.checkbox_db), when the checkbox(input.check-group) is
I'm using FuelUX to create a Pillbox so that the user can add keywords
I'm using this plugin: http://loopj.com/jquery-tokeninput/ to do a suggestion field, where the user can
I want to catch the enter key press when the user is filling an
I've created an input field that submits a simple field when the enter key

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.